<template>
    <div>
        <p>{{ $store.state.random }}</p>
        <p>count: {{ $store.state.count }}</p>
        <p>dbCount: {{ $store.getters.dbCount }}</p>
        <!-- <p>token: {{ $store.getters.token }}</p> -->
        <p>{{ obj.token }}</p>
        <button @click="setRandom">setRandom</button>
        <button @click="addCount">addCount</button>
    </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
// const { mapState } = createNamespacedHelpers("user");
export default {
    // computed: {
    //     dbCount() {
    //         console.log("dbCount触发了");
    //         return this.$store.state.count * 2;
    //     },
    // },
    computed: {
        // 第一个参数为命名空间，第二参数为需要获取值的数组
        ...mapState("user", ["obj"]),
    },
    methods: {
        ...mapMutations(["setRandom", "addCount"]),
        // dbCount() {
        //     console.log("dbCount触发了");
        //     return this.$store.state.count * 2;
        // },
    },
};
</script>

<style></style>
